package com.wenx.v3system.modular.cloud.domain.dto;

import com.wenx.base.domain.BaseDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;

/**
 * 系统权限DTO
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Schema(description = "系统权限信息")
public class SysPermissionDto extends BaseDto {

    @NotBlank(message = "权限名称不能为空")
    @Size(max = 100, message = "权限名称长度不能超过100个字符")
    @Schema(description = "权限名称", example = "用户管理")
    private String name;

    @NotBlank(message = "权限编码不能为空")
    @Size(max = 100, message = "权限编码长度不能超过100个字符")
    @Schema(description = "权限编码", example = "user:manage")
    private String code;

    @NotNull(message = "权限类型不能为空")
    @Schema(description = "权限类型：menu-菜单，button-按钮，api-API", example = "menu")
    private String type;

    @Schema(description = "权限分类", example = "user")
    private String category;

    @Schema(description = "资源类型", example = "user")
    private String resource;

    @Schema(description = "操作类型", example = "read")
    private String action;

    @Schema(description = "权限作用域：global-全局，department-部门，team-团队，owner-所有者，custom-自定义", example = "global")
    private String scope;

    @Schema(description = "父权限ID", example = "4000")
    private Long parentId;

    @Schema(description = "权限路径", example = "/system/user")
    private String path;

    @Schema(description = "HTTP方法", example = "GET")
    private String method;

    @Size(max = 500, message = "权限描述长度不能超过500个字符")
    @Schema(description = "权限描述", example = "用户管理相关权限")
    private String description;

    @Schema(description = "图标", example = "user")
    private String icon;

    @Schema(description = "组件路径", example = "/views/system/user/index")
    private String component;

    @Schema(description = "重定向路径", example = "/system/user/list")
    private String redirect;

    @Schema(description = "是否隐藏", example = "false")
    private Boolean hidden;

    @Schema(description = "是否总是显示", example = "true")
    private Boolean alwaysShow;

    @Schema(description = "是否内置权限", example = "false")
    private Boolean isBuiltin;

    @Schema(description = "优先级", example = "1")
    private Integer priority;

    @Schema(description = "排序", example = "1")
    private Long sort;

    @Schema(description = "权限状态：1-启用，0-禁用", example = "1")
    private Integer status;

    // 关联关系
    @Schema(description = "父权限信息")
    private SysPermissionDto parent;

    @Schema(description = "子权限列表")
    private List<SysPermissionDto> children;
}